<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">

<head>
    <th:block th:include="include :: header('内容设置')" />
    <th:block th:include="include::bootstrap-select-css" />
</head>

<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <div class="tabs-container">
            <ul class="nav nav-tabs" id="config-title">
                <li class="active"><a data-toggle="tab" href="#article" aria-expanded="false">文章设置</a>
                </li>
                <li><a data-toggle="tab" href="#shop" aria-expanded="false">联盟设置</a>
                </li>
            </ul>
            <div class="tab-content" th:with="cmsConfig=${@configTag.getConfigValueMap('cmsConfig')}">
                <!--文章发布设置-->
                <div id="article" class="tab-pane active">
                    <div class="panel-body">
                        <form class="form-horizontal m" id="form-article">
                            <div class="form-group">
                                <label class="col-sm-3 control-label is-">分类上限：</label>
                                <div class="col-sm-8">
                                    <input name="oly.cms.articleCat.maxNum"
                                        th:value="${cmsConfig['oly.cms.articleCat.maxNum']}" class="form-control"
                                        type="number">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label is-">标签上限：</label>
                                <div class="col-sm-8">
                                    <input name="oly.cms.articleTag.maxNum"
                                        th:value="${cmsConfig['oly.cms.articleTag.maxNum']}" class="form-control"
                                        type="number">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label is-">关键词上限：</label>
                                <div class="col-sm-8">
                                    <input name="oly.cms.articleKeyword.maxNum"
                                        th:value="${cmsConfig['oly.cms.articleKeyword.maxNum']}" class="form-control"
                                        type="number">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label is-">预览图上限：</label>
                                <div class="col-sm-8">
                                    <input name="oly.cms.articleImg.maxNum"
                                        th:value="${cmsConfig['oly.cms.articleImg.maxNum']}" class="form-control"
                                        type="number">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label is-">固定链接前缀：</label>
                                <div class="col-sm-8">
                                    <input name="oly.cms.articleUrl.fixedPrefix"
                                        th:value="${cmsConfig['oly.cms.articleUrl.fixedPrefix']}" class="form-control"
                                        type="text">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label is-">文章默认状态：</label>
                                <div class="col-sm-8">
                                    <div class="radio-box" th:each="dict : ${@dictTag.getType('cms_article_visible')}">
                                        <input type="radio" th:id="${dict.dictCode}"
                                            name="oly.cms.articleVisible.default" th:value="${dict.dictValue}"
                                            th:checked="${cmsConfig['oly.cms.articleVisible.default'] eq dict.dictValue}">
                                        <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <!--联盟设置-->
                <div id="shop" class="tab-pane">
                    <div class="panel-body">
                        <form class="form-horizontal m" id="form-shop">
                            <div class="form-group">
                                <label class="col-sm-3 control-label is-">默认状态：</label>
                                <div class="col-sm-8">
                                    <div class="radio-box" th:each="dict : ${@dictTag.getType('cms_union_visible')}">
                                        <input type="radio" th:id="${dict.dictCode}" name="oly.cms.union.defaultVisible"
                                            th:value="${dict.dictValue}"
                                            th:checked="${cmsConfig['oly.cms.union.defaultVisible'] eq dict.dictValue}">
                                        <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label is-">关联类型：</label>
                                <div class="col-sm-8">
                                    <div class="radio-box" th:each="dict : ${@dictTag.getType('cms_support_type')}">
                                        <input type="radio" th:id="${dict.dictCode}" name="oly.cms.union.type"
                                            th:value="${dict.dictValue}"
                                            th:checked="${cmsConfig['oly.cms.union.type'] eq dict.dictValue}">
                                        <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label is-">父分类ID：</label>
                                <div class="col-sm-8">
                                    <input name="oly.cms.union.catId" th:value="${cmsConfig['oly.cms.union.catId']}"
                                        class="form-control" type="number">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label is-">标签数量：</label>
                                <div class="col-sm-8">
                                    <input name="oly.cms.union.tagSize" th:value="${cmsConfig['oly.cms.union.tagSize']}"
                                        class="form-control" type="number">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label is-">分类数量：</label>
                                <div class="col-sm-8">
                                    <input name="oly.cms.union.catSize" th:value="${cmsConfig['oly.cms.union.catSize']}"
                                        class="form-control" type="number">
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
            <br>
            <button type="button" class="btn btn-w-m btn-primary center-block" id="submit-btn">修改</button>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include::bootstrap-select-js" />
    <script type="text/javascript">
        var prefix = ctx + "cms/config";
        var myForm = "form-article";
        $('#config-title a').click(function (e) {
            e.preventDefault();
            $(this).tab('show');
            myForm = $(this).attr('href').replace("#", "form-");
        });

        function submitHandler() {
            var data = $("#" + myForm).serializeArray();
            data.push({ "name": "configGroup", "value": "cmsConfig" });
            $.operate.saveModal(prefix + "/updateByGk", data);

        }
        $("#submit-btn").click(function () {
            submitHandler();
        })
    </script>
</body>

</html>